// @ts-ignore
/* eslint-disable */
import { request } from 'umi';

/** 获取系统驱动列表 GET /api/driver */
export async function queryDriver(
  params: {
    // query
    /** 当前的页码 */
    current?: number;
    /** 页面的容量 */
    pageSize?: number;
  },
  options?: { [key: string]: any },
) {
  return request<API.RequestData>('/api/driver', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

/** 更新系统驱动 PUT /api/driver */
export async function updateDriver(body: API.DriverItem, options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/driver', {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 添加系统驱动 POST /api/driver */
export async function addDriver(body: API.DriverItem, options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/driver', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

/** 删除系统驱动 DELETE /api/driver */
export async function removeDriver(options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/driver', {
    method: 'DELETE',
    params: {
      ...options,
    },
    ...(options || {}),
  });
}

/** 删除系统驱动 DELETE /api/driver */
export async function batchRemoveDriver(options?: { [key: string]: any }) {
  return request<Record<string, any>>('/api/driver/batchdel', {
    method: 'DELETE',
    params: {
      ...options,
    },
    ...(options || {}),
  });
}

/** 获取设备类型列表 GET /api/device/type */
export async function queryDriverList() {
  return request<API.RequestData>('/api/driver/list', {
    method: 'GET',
  });
}